<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <title>title</title>
        <link rel="stylesheet" href="../../css/api.css"/>
        <link rel="stylesheet" href="../../css/common.css" />
        <link rel="stylesheet" href="../../css/query.css"/>
        <link rel="stylesheet" href="../../script/ccssoft/css/ccssoft-lite.css" />
        <link rel="stylesheet" href="../../css/aui.css"/>
        <style>
          #searchHistory p{
            text-align: center;
            padding: 8px 0;
            border-bottom: 1px solid #efefef;
          }

        </style>
    </head>
    <style>
        html, body {
            height: auto;
        }
        body.active {
            background: url(../../image/icons/png/page_icon_empty.png) no-repeat center center;
        }
        .user-info{
            font-size: 12px;
            font-weight: bold;
            line-height: 28px;
            padding: 2px 12px 0px 12px;
            color:black;
            position: relative;
        }
        .selectable-list-row.active{
            background-color: #eda4a2;
        }
    </style>
    <body>
      <div id="searchHistory" style="width:100%;background-color:#fff;display:none;">

      </div>
        <div id="main">
            <ul  id="listView" class="ccssoft_list"></ul>
        </div>
        <script id="listView-template" type="text/x-dot-template">
            {{ userList = it; }}
            {{ for(var i=0, len=it.length; i < len; i++) {}}
                <li onclick="userClick({{=i}})" user-id="{{=it[i].userId}}" class="selectable-list-row">
                <div class="user-info">{{=it[i].userName}}</div>
                </li>
            {{}}}
        </script>
    </body>
    <script src="../../script/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/debug.js"></script>
    <script type="text/javascript" src="../../script/config.js"></script>
    <script type="text/javascript" src="../../script/doT.min.js"></script>
    <script src="../../script/client.api.js"></script>
    <script type="text/javascript" src="../../script/aui-alert.js"></script>
    <script src="../../script/common.js"></script>
    <script src="../../script/ccssoft/js/ccssoft-lite.js"></script>
    <script type="text/javascript" src="../../script/request.js"></script>
<!--    <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>-->
<!--    <script >-->
<!--        var vConsole = new VConsole();-->
<!--    </script>-->
    <script type="text/javascript">
        request.searchUserList = function(params,callback){
            service({
                url:"/user/pageList.do",
                data:params
            },callback)
        }

        var userList = [];
        apiready = function() {
            initHeader();
            listView = new C.ApiListView({
                fn : request.searchUserList,
                newSystem: true,
                callback:afterLoad,
                debug:true
            });
            listView.setQueryOptions({stationId:api.pageParam.stationId});
            listView.refresh();
        };

        function afterLoad(){
            if(api.pageParam.selectedUserInfo.userId){
                $("[user-id='" + api.pageParam.selectedUserInfo.userId +"']").addClass("active").siblings().removeClass("active");
            }
        }

        function userClick(index) {
            var userInfo = userList[index];
            $(".selectable-list-row").eq(index).addClass("active").siblings().removeClass("active");
            if(userInfo){
                api.execScript({
                    name : 'checkStandBill',
                    frameName : 'churuzhanBillAudit',
                    script : "onUserSelect(" + JSON.stringify(userInfo) + ");"
                });
                api.closeWin();
            }
        }

    </script>
</html>
